﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn"	uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
  <head>
  	
  	<%@ include file="/WEB-INF/include/meta.jsp" %>
  	<%@ include file="/WEB-INF/include/css.jsp" %>
  	<link href="${ctx.resource}/css/bootstrap-switch.min.css" rel="stylesheet">
	
	<title>${startup.profile.name} - 众投湾</title>
	
	<fmt:setBundle basename="ApplicationMessage"/>
	<fmt:setLocale value="zh_CN"/>
	
  </head>

  <body>
  
	<%@ include file="/WEB-INF/include/header.jsp" %>
	
	  <div class="container">
	  
	    <div class="zz-startup-cover">
	      <a class="zz-startup-avatar-wrapper" href="${ctx}/startups/${startup.id}">
	        <img class="img-thumbnail" src="${ctx.upload}/${startup.profile.avatar}">
	      </a>
	      
	      <div class="zz-startup-cover-letter">
	        <div class="zz-startup-cover-title">${startup.profile.name}</div>
	        <span class="font-size-14 label label-success" style="font-weight: normal;">
	          <fmt:message key="${startup.profile.businessStatus.key}" /><c:if test="${not empty startup.profile.supplement}">（${startup.profile.supplement}）</c:if>
	        </span>&nbsp;
	        <span class="font-size-14 label label-success" style="font-weight: normal;">
	          <fmt:message key="${startup.fundStatus.key}" />
	        </span>
	        <p class="line-ellipsis font-size-16 bottom-margin-15">${startup.profile.alias}</p>
	        <p class="line-ellipsis text-muted font-size-14 bottom-margin-15">
	          <i class="glyphicon glyphicon-map-marker"></i>&nbsp;${startup.profile.region}&nbsp;&nbsp;&nbsp;&nbsp;
	          <i class="glyphicon glyphicon-tags"></i>
	          <c:forEach var="tag" items="${fn:split(startup.tags, ',')}" varStatus="count">
	          	<c:choose>
	          	  <c:when test="${count.index == 0}">
	          	    &nbsp;${tag}
	          	  </c:when>
	          	  <c:otherwise>
	          	    &nbsp;<strong>·</strong>&nbsp;${tag}
	          	  </c:otherwise>
	          	</c:choose>
	          </c:forEach>
	        </p>
	        
	        <c:if test="${isLoginUser}">
	        <div class="operation-button-groups">
	          <c:choose>
			  <c:when test="${isSubscribed}">
	          	<a href="javascript:unsubscribe(${startup.id});" id="subscribe-btn" class="btn btn-success demo2do-input-small-width">取消关注</a>
			  </c:when>
			  <c:otherwise>
	          	<a href="javascript:subscribe(${startup.id});" id="subscribe-btn" class="btn btn-success demo2do-input-small-width">关注</a>
			  </c:otherwise>
			  </c:choose>

	          <a href="#" class="btn btn-primary demo2do-input-small-width">分享</a>
	        </div>
			</c:if>
	      </div><!-- zz-startup-cover-letter -->
	      
	      <ul class="nav nav-tabs zz-startup-tabs">
	        <li><a href="${ctx}/startups/${startup.id}/detail">项目概况</a></li>
	        <li class="active"><a href="javascript: void(0)">投资逻辑</a></li>
	        <li><a href="${ctx}/startups/${startup.id}/team">团队简介</a></li>
	        <li><a href="${ctx}/startups/${startup.id}/events">项目动态</a></li>
	      </ul>
	    </div><!-- zz-startup-cover -->
	    
	    <div class="zz-startup-content">
	      
	      <div class="col-lg-8 col-md-8 zz-startup-left-layout">
	      
	      	<c:choose>
	      	<c:when test="${isLoginUser}">
		        <div class="panel panel-default zz-startup-panel">
		          <div class="panel-heading zz-startup-panel-heading"><b>详细介绍</b></div>
		          <div class="panel-body">
		            ${startup.proposal.detail}
		          </div>
		        </div>
		        
		        <div class="panel panel-default zz-startup-panel">
		          <div class="panel-heading zz-startup-panel-heading"><b>项目亮点</b></div>
		          <div class="panel-body">
		            ${startup.proposal.highlight}
		          </div>
		        </div>
		        
		        <div class="panel panel-default zz-startup-panel">
		          <div class="panel-heading zz-startup-panel-heading"><b>市场规模</b></div>
		          <div class="panel-body">
		            ${startup.proposal.market}
		          </div>
		        </div>
		        
		        <div class="panel panel-default zz-startup-panel">
		          <div class="panel-heading zz-startup-panel-heading"><b>同行参考</b></div>
		          <div class="panel-body">
		            ${startup.proposal.competitor}
		          </div>
		        </div>
			</c:when>

			<c:otherwise>
				<div class="panel panel-default zz-startup-panel">
				<div class="zz-startups">
					<form action="${ctx}/login" method="GET" style="text-align: center;">
						<input type="hidden" name="beforeLoginUri" value="${currentUri}">
						<input class="btn btn-lg btn-success btn-shadow btn-shadow-success" style="width: 200px;" type="submit" value="请登录后查看" />
					</form>
				</div>
				</div>
			</c:otherwise>
			</c:choose>
	      
	      </div><!-- zz-startup-left-layout -->
	      
		  <%@ include file="/WEB-INF/jsps/startup/include/right-layout.jsp" %>
	      
	    </div><!-- zz-startup-content -->
	    
	  </div>
	
	<%@ include file="/WEB-INF/include/footer.jsp" %>
	<%@ include file="/WEB-INF/include/script.jsp" %>
	<script src="${ctx.resource}/js/jquery.raty.min.js"></script>
	<script src="${ctx.resource}/js/bootstrap-modal-trigger.js"></script>
	<script src="${ctx.resource}/js/bootstrap.validate.js"></script>
    <script src="${ctx.resource}/js/bootstrap.validate.en.js"></script>
    <script src="${ctx.resource}/js/bootstrap-switch.min.js"></script>
	
	<script>
	
	  function subscribe(id) {
	    $.get("${ctx}/startups/"+id+"/subscribe",function(data,status){
		  if(data) {
		    $('#subscribe-btn').text('取消关注');
		    $('#subscribe-btn').attr('href', 'javascript:unsubscribe('+id+');');
		  }
	    });
	  }

	  function unsubscribe(id) {
	    $.get("${ctx}/startups/"+id+"/unsubscribe",function(data,status){
	      if(data) {
		    $('#subscribe-btn').text('关注');
		    $('#subscribe-btn').attr('href', 'javascript:subscribe('+id+');');
		  }
	    });
	  }

	  $(function() {
		$(".show-rating").raty({
		  path      : "${ctx.resource}/img",
		  half      : true,
		  target    : ".show-rating-hint",
		  readOnly  : true,
		  score     : function() {
		    return $(this).data("score");
		  }
		});
		
		$(".show-rating").each(function() {
		  $(this).next().text($(this).data("score"));
		});
	  });
	  
	</script>
    
  </body>
  
</html>
